package util;

import java.awt.Color;

import javax.swing.JTextField;

/**
 * 带提示的输入框,获得焦点时提示自动消失
 * @author season
 *
 */
public class TipsTextField extends JTextField{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String tips;
	private Color textColor, tipsColor;

	/**
	 * 
	 * @param tips	要提示的内容
	 */
	public TipsTextField(String tips) {
		this.tips = tips;
		tipsColor = Color.gray;
		setText(tips);
		setForeground(tipsColor);
		addFocusListener(TipsFieldListener.getInstance());
	}

	public void setTextColor(Color textColor) {
		this.textColor = textColor;
	}


	public String getTips() {
		return tips;
	}

	public void setTips(String tips) {
		this.tips = tips;
	}

	public Color getTipsColor() {
		return tipsColor;
	}

	public void setTipsColor(Color tipsColor) {
		this.tipsColor = tipsColor;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Color getTextColor() {
		return textColor;
	}

	
}
